<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<?php
require "hrfuns.php";
Valid_Client();
$iSQL = GetSQL();
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<title>Vacation Information</title>
<link rel="stylesheet" href="hr.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<script src="hr.js"></script>
<script type="text/javascript">
<!--

function doModify(em_id)
{
    frmMod = document.forms['frm' + em_id];
    Employee = em_id + '(' + frmMod.elements['txtEmName'].value + ')';

    if (confirm('确认修改员工 ' + Employee + '的信息吗？')) {

        submitstr = 'Action=Modify'
                 + '&EmId=' + em_id
                 + '&Va_1=' + frmMod.elements['txtVa_1'].value
                 + '&Va_2=' + frmMod.elements['txtVa_2'].value;

        var request = CreateHttpRequest();

        request.open('POST', 'valimit_do.php', false);
        request.setRequestHeader('Content-type','application/x-www-form-urlencoded');
        request.send(submitstr);

        if (request.responseText.length > 0) 
            alert(request.responseText);

    }
}


-->
</script>
</head>

<body>

<br />
<div id="header" style="background-color:#FFA500;clear:both;text-align:right;"
 onclick="window.location.assign('/hr')"><u>返回</u></div>

<table bgcolor=#c8c8c8 cellspacing=1 cellpadding=2 align="center">
<tr>
    <th>员工号</th>
    <th>员工姓名</th>
    <th>法定休假</th>
    <th>福利休假</th>
    <th>&nbsp;</th>
</tr>
<?php
$sqlstr = "select em_id, em_name, em_depart_id, va_1_length, va_2_length"
        . " from vathis_v order by em_depart_id, em_id";
$resEm = $iSQL->query($sqlstr);

while ($row = $resEm->fetch_assoc()) {
    echo "<form id=\"frm" . $row["em_id"] . "\">\n";
    
    if ($row["em_depart_id"] == 100)
        echo "<tr class=\"resign_tr\">\n";
    else
        echo "<tr>\n";
    echo "    <td><input type=\"text\" readonly=\"readonly\" id=\"txtEmId\""
        . " class=\"input-box\" value=\"" . $row["em_id"] . "\"/></td>\n";
    echo "    <td>" . $row["em_name"] . "<input type=\"hidden\" id=\"txtEmName\""
        . " value=\"" . $row["em_name"] . "\"/></td>\n";
    echo "    <td><input type=\"text\" id=\"txtVa_1\""
        . " class=\"input-box\" value=\"" . $row["va_1_length"] . "\"/></td>\n";
    echo "    <td><input type=\"text\" id=\"txtVa_2\" class=\"input-box\""
        . " class=\"input-box\" value=\"" . $row["va_2_length"] . "\"/></td>\n";
    echo "    <td><button type=\"button\""
        . " onclick=\"doModify('" . $row["em_id"] . "')\">Modify</button>\n";
    echo "    </td>\n";

    echo "</tr>\n";
    echo "</form>\n";
}
?>
</table>
<div style="clear:both;">&nbsp;</div>
<div id="footer" style="background-color:#FFA500;clear:both;text-align:right;">
<a href="/hr">返回</a></div>
<?php
// show current employee information
$iSQL->close();
?>
</body>
</html>
